#include <iostream>
#include <vector>
using namespace std;

void proc(vector<int> &nums,int now,vector<int>& temp,vector<vector<int>>& res)
{
	if(now == nums.size())
	{
		res.push_back(temp);
		return;
	}

	size_t temps=temp.size();
	proc(nums,now+1,temp,res);
	temp.push_back(nums[now]);
	proc(nums,now+1,temp,res);
	temp.resize(temps);
}

vector<vector<int>> subsets(vector<int>& nums)
{
    if (nums.empty())
	return {};
    vector<vector<int>> res;
    vector<int> temp;
    proc(nums,0,temp,res);
    return res;
}

int main(int argc, char* argv[])
{

	vector<int> a={1,2,3};
	auto p=subsets(a);
	for(int i=0;i<p.size();++i)
	{
		if(p[i].size() == 0)
		{
			cout<<"kong"<<endl;
			continue;
		}
		for(int j=0;j<p[i].size();++j)
		{
			cout<<p[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
    return 0;
}
